"""
PyInstaller hook for FastAPI
Ensures all FastAPI components are properly included
"""

from PyInstaller.utils.hooks import collect_submodules, collect_data_files

# Collect all FastAPI submodules
hiddenimports = collect_submodules('fastapi')

# Add specific FastAPI imports that might be missed
hiddenimports += [
    'fastapi.staticfiles',
    'fastapi.templating', 
    'fastapi.responses',
    'fastapi.middleware',
    'fastapi.middleware.cors',
    'fastapi.middleware.trustedhost',
    'fastapi.security',
    'fastapi.security.oauth2',
    'fastapi.security.api_key',
    'fastapi.encoders',
    'fastapi.exceptions',
    'fastapi.utils',
    'fastapi.routing',
    'starlette.applications',
    'starlette.routing',
    'starlette.responses',
    'starlette.staticfiles',
    'starlette.middleware',
    'starlette.middleware.cors',
    'uvicorn.protocols.http.auto',
    'uvicorn.protocols.websockets.auto',
    'uvicorn.lifespan.on',
    'uvicorn.loops.auto',
]

# Collect data files if any
datas = collect_data_files('fastapi')